import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { ActiveShieldInfo } from "../model/ActiveShieldInfo";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
//class ActiveShieldConfig
    
    export  class ActiveShieldConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (ActiveShieldConfig._instance != null) 
            {
                throw new Error(" ResConfig 单例 ");
            }
            this.init();
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_active_shield.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new ActiveShieldInfo();
                loc1.effectId = loc2.sceneEffect;
                loc1.npcId = loc2.npc;
                loc1.startTime = StringHelper.getString(loc2.startTime);
                loc1.endTime = StringHelper.getString(loc2.endTime);
                loc1.updateData();
                this._map[loc1.npcId + "_" + loc1.effectId] = loc1;
            }
            return;
        }

        public getNpcListBeforeDate(arg1: number): Array<any>
        {
            var loc2=null;
            var loc1=[];
            var loc3=0;
            var loc4=this._map;
            for(loc2 of loc4) 
            {
                if (!(!(loc2.npcId == 0) && loc2.startDate.time / 1000 < arg1)) 
                {
                    continue;
                }
                loc1.push(loc2.npcId);
            }
            return loc1;
        }

        public getEffectListBeforeDate(arg1: number): Array<any>
        {
            var loc2=null;
            var loc1=[];
            var loc3=0;
            var loc4=this._map;
            for(loc2 of loc4) 
            {
                if (!(!(loc2.effectId == 0) && loc2.startDate.time / 1000 < arg1)) 
                {
                    continue;
                }
                loc1.push(loc2.effectId);
            }
            return loc1;
        }

        public static get instance(): ActiveShieldConfig
        {
            if (ActiveShieldConfig._instance == null) 
            {
                ActiveShieldConfig._instance = new ActiveShieldConfig();
            }
            return ActiveShieldConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: ActiveShieldConfig;
    }
